package com.lanou.connotationjoke.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lanou.connotationjoke.view.NewListView;
import com.lanou.connotationjoke.R;
import com.lanou.connotationjoke.adapter.HomeCollectListViewAdapter;
import com.lanou.connotationjoke.db.HomeCollectEntity;
import com.lanou.connotationjoke.db.HomeCollectEntityDao;
import com.lanou.connotationjoke.tool.DaoSingleton;

import java.util.List;

/**
 * Created by Administrator on 2016/2/4.
 */
public class HomeCollectFragment extends BaseFragment{
    private NewListView listView;
    private List<HomeCollectEntity> datas;
    private HomeCollectListViewAdapter adapter;
    private HomeCollectEntityDao homeCollectEntityDao =
            DaoSingleton.getInstance().getHomeCollectEntityDao();
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home_collect,null);
        listView = (NewListView) view.findViewById(R.id.listview_home_collect);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        datas = homeCollectEntityDao.queryBuilder().list();
        adapter = new HomeCollectListViewAdapter(getActivity(),datas);
        listView.setAdapter(adapter);
    }
}
